<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/xml/qxml.cpp -->
<head>
  <title>Qt 4.3: QXmlContentHandler Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QXmlContentHandler Class Reference<br /><sup><sup>[<a href="qtxml.html">QtXml</a> module]</sup></sup></h1>
<p>The QXmlContentHandler class provides an interface to report the logical content of XML data. <a href="#details">More...</a></p>
<pre> #include &lt;QXmlContentHandler&gt;</pre><p>Inherited by <a href="qxmldefaulthandler.html">QXmlDefaultHandler</a>.</p>
<p><b>Note:</b> All the functions in this class are <a href="threads.html#reentrant">reentrant</a>.</p>
<ul>
<li><a href="qxmlcontenthandler-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/>virtual <b><a href="qxmlcontenthandler.html#dtor.QXmlContentHandler">~QXmlContentHandler</a></b> ()</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#characters">characters</a></b> ( const QString &amp; <i>ch</i> ) = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#endDocument">endDocument</a></b> () = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#endElement">endElement</a></b> ( const QString &amp; <i>namespaceURI</i>, const QString &amp; <i>localName</i>, const QString &amp; <i>qName</i> ) = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#endPrefixMapping">endPrefixMapping</a></b> ( const QString &amp; <i>prefix</i> ) = 0</li>
<li><div class="fn"/>virtual QString <b><a href="qxmlcontenthandler.html#errorString">errorString</a></b> () const = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#ignorableWhitespace">ignorableWhitespace</a></b> ( const QString &amp; <i>ch</i> ) = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#processingInstruction">processingInstruction</a></b> ( const QString &amp; <i>target</i>, const QString &amp; <i>data</i> ) = 0</li>
<li><div class="fn"/>virtual void <b><a href="qxmlcontenthandler.html#setDocumentLocator">setDocumentLocator</a></b> ( QXmlLocator * <i>locator</i> ) = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#skippedEntity">skippedEntity</a></b> ( const QString &amp; <i>name</i> ) = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#startDocument">startDocument</a></b> () = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#startElement">startElement</a></b> ( const QString &amp; <i>namespaceURI</i>, const QString &amp; <i>localName</i>, const QString &amp; <i>qName</i>, const QXmlAttributes &amp; <i>atts</i> ) = 0</li>
<li><div class="fn"/>virtual bool <b><a href="qxmlcontenthandler.html#startPrefixMapping">startPrefixMapping</a></b> ( const QString &amp; <i>prefix</i>, const QString &amp; <i>uri</i> ) = 0</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QXmlContentHandler class provides an interface to report the logical content of XML data.</p>
<p>If the application needs to be informed of basic parsing events, it can implement this interface and activate it using <a href="qxmlreader.html#setContentHandler">QXmlReader::setContentHandler</a>(). The reader can then report basic document-related events like the start and end of elements and character data through this interface.</p>
<p>The order of events in this interface is very important, and mirrors the order of information in the document itself. For example, all of an element's content (character data, processing instructions, and sub-elements) appears, in order, between the <a href="qxmlcontenthandler.html#startElement">startElement</a>() event and the corresponding <a href="qxmlcontenthandler.html#endElement">endElement</a>() event.</p>
<p>The class <a href="qxmldefaulthandler.html">QXmlDefaultHandler</a> provides a default implementation for this interface; subclassing from the <a href="qxmldefaulthandler.html">QXmlDefaultHandler</a> class is very convenient if you only want to be informed of some parsing events.</p>
<p>The <a href="qxmlcontenthandler.html#startDocument">startDocument</a>() function is called at the start of the document, and <a href="qxmlcontenthandler.html#endDocument">endDocument</a>() is called at the end. Before parsing begins <a href="qxmlcontenthandler.html#setDocumentLocator">setDocumentLocator</a>() is called. For each element <a href="qxmlcontenthandler.html#startElement">startElement</a>() is called, with <a href="qxmlcontenthandler.html#endElement">endElement</a>() being called at the end of each element. The <a href="qxmlcontenthandler.html#characters">characters</a>() function is called with chunks of character data; <a href="qxmlcontenthandler.html#ignorableWhitespace">ignorableWhitespace</a>() is called with chunks of whitespace and <a href="qxmlcontenthandler.html#processingInstruction">processingInstruction</a>() is called with processing instructions. If an entity is skipped <a href="qxmlcontenthandler.html#skippedEntity">skippedEntity</a>() is called. At the beginning of prefix-URI scopes <a href="qxmlcontenthandler.html#startPrefixMapping">startPrefixMapping</a>() is called.</p>
<p>See also <a href="qxmldtdhandler.html">QXmlDTDHandler</a>, <a href="qxmldeclhandler.html">QXmlDeclHandler</a>, <a href="qxmlentityresolver.html">QXmlEntityResolver</a>, <a href="qxmlerrorhandler.html">QXmlErrorHandler</a>, <a href="qxmllexicalhandler.html">QXmlLexicalHandler</a>, and <a href="qtxml.html#introduction-to-sax2">Introduction to SAX2</a>.</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="dtor.QXmlContentHandler"></a>QXmlContentHandler::~QXmlContentHandler ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
<p>Destroys the content handler.</p>
<h3 class="fn"><a name="characters"></a>bool QXmlContentHandler::characters ( const <a href="qstring.html">QString</a> &amp; <i>ch</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function when it has parsed a chunk of character data (either normal character data or character data inside a CDATA section; if you need to distinguish between those two types you must use <a href="qxmllexicalhandler.html#startCDATA">QXmlLexicalHandler::startCDATA</a>() and <a href="qxmllexicalhandler.html#endCDATA">QXmlLexicalHandler::endCDATA</a>()). The character data is reported in <i>ch</i>.</p>
<p>Some readers report whitespace in element content using the <a href="qxmlcontenthandler.html#ignorableWhitespace">ignorableWhitespace</a>() function rather than using this one.</p>
<p>A reader may report the character data of an element in more than one chunk; e.g&#x2e; a reader might want to report &quot;a&lt;b&quot; in three characters() events (&quot;a &quot;, &quot;&lt;&quot; and &quot; b&quot;).</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<h3 class="fn"><a name="endDocument"></a>bool QXmlContentHandler::endDocument ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function after it has finished parsing. It is called just once, and is the last handler function called. It is called after the reader has read all input or has abandoned parsing because of a fatal error.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<p>See also <a href="qxmlcontenthandler.html#startDocument">startDocument</a>().</p>
<h3 class="fn"><a name="endElement"></a>bool QXmlContentHandler::endElement ( const <a href="qstring.html">QString</a> &amp; <i>namespaceURI</i>, const <a href="qstring.html">QString</a> &amp; <i>localName</i>, const <a href="qstring.html">QString</a> &amp; <i>qName</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function when it has parsed an end element tag with the qualified name <i>qName</i>, the local name <i>localName</i> and the namespace URI <i>namespaceURI</i>.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<p>See also <a href="qxmlcontenthandler.html#startElement">startElement</a>() and <a href="qtxml.html#namespace-support-via-features">Namespace Support via Features</a>.</p>
<h3 class="fn"><a name="endPrefixMapping"></a>bool QXmlContentHandler::endPrefixMapping ( const <a href="qstring.html">QString</a> &amp; <i>prefix</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function to signal the end of a prefix mapping for the prefix <i>prefix</i>.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<p>See also <a href="qxmlcontenthandler.html#startPrefixMapping">startPrefixMapping</a>() and <a href="qtxml.html#namespace-support-via-features">Namespace Support via Features</a>.</p>
<h3 class="fn"><a name="errorString"></a><a href="qstring.html">QString</a> QXmlContentHandler::errorString () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function to get an error string, e.g&#x2e; if any of the handler functions returns false.</p>
<h3 class="fn"><a name="ignorableWhitespace"></a>bool QXmlContentHandler::ignorableWhitespace ( const <a href="qstring.html">QString</a> &amp; <i>ch</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Some readers may use this function to report each chunk of whitespace in element content. The whitespace is reported in <i>ch</i>.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<h3 class="fn"><a name="processingInstruction"></a>bool QXmlContentHandler::processingInstruction ( const <a href="qstring.html">QString</a> &amp; <i>target</i>, const <a href="qstring.html">QString</a> &amp; <i>data</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function when it has parsed a processing instruction.</p>
<p><i>target</i> is the target name of the processing instruction and <i>data</i> is the data in the processing instruction.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<h3 class="fn"><a name="setDocumentLocator"></a>void QXmlContentHandler::setDocumentLocator ( <a href="qxmllocator.html">QXmlLocator</a> * <i>locator</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function before it starts parsing the document. The argument <i>locator</i> is a pointer to a <a href="qxmllocator.html">QXmlLocator</a> which allows the application to get the parsing position within the document.</p>
<p>Do not destroy the <i>locator</i>; it is destroyed when the reader is destroyed. (Do not use the <i>locator</i> after the reader is destroyed).</p>
<h3 class="fn"><a name="skippedEntity"></a>bool QXmlContentHandler::skippedEntity ( const <a href="qstring.html">QString</a> &amp; <i>name</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>Some readers may skip entities if they have not seen the declarations (e.g&#x2e; because they are in an external DTD). If they do so they report that they skipped the entity called <i>name</i> by calling this function.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<h3 class="fn"><a name="startDocument"></a>bool QXmlContentHandler::startDocument ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function when it starts parsing the document. The reader calls this function just once, after the call to <a href="qxmlcontenthandler.html#setDocumentLocator">setDocumentLocator</a>(), and before any other functions in this class or in the <a href="qxmldtdhandler.html">QXmlDTDHandler</a> class are called.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<p>See also <a href="qxmlcontenthandler.html#endDocument">endDocument</a>().</p>
<h3 class="fn"><a name="startElement"></a>bool QXmlContentHandler::startElement ( const <a href="qstring.html">QString</a> &amp; <i>namespaceURI</i>, const <a href="qstring.html">QString</a> &amp; <i>localName</i>, const <a href="qstring.html">QString</a> &amp; <i>qName</i>, const <a href="qxmlattributes.html">QXmlAttributes</a> &amp; <i>atts</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function when it has parsed a start element tag.</p>
<p>There is a corresponding <a href="qxmlcontenthandler.html#endElement">endElement</a>() call when the corresponding end element tag is read. The startElement() and <a href="qxmlcontenthandler.html#endElement">endElement</a>() calls are always nested correctly. Empty element tags (e.g&#x2e; <tt>&lt;x/&gt;</tt>) cause a startElement() call to be immediately followed by an <a href="qxmlcontenthandler.html#endElement">endElement</a>() call.</p>
<p>The attribute list provided only contains attributes with explicit values. The attribute list contains attributes used for namespace declaration (i.e&#x2e; attributes starting with xmlns) only if the namespace-prefix property of the reader is true.</p>
<p>The argument <i>namespaceURI</i> is the namespace URI, or an empty string if the element has no namespace URI or if no namespace processing is done. <i>localName</i> is the local name (without prefix), or an empty string if no namespace processing is done, <i>qName</i> is the qualified name (with prefix) and <i>atts</i> are the attributes attached to the element. If there are no attributes, <i>atts</i> is an empty attributes object.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<p>See also <a href="qxmlcontenthandler.html#endElement">endElement</a>() and <a href="qtxml.html#namespace-support-via-features">Namespace Support via Features</a>.</p>
<h3 class="fn"><a name="startPrefixMapping"></a>bool QXmlContentHandler::startPrefixMapping ( const <a href="qstring.html">QString</a> &amp; <i>prefix</i>, const <a href="qstring.html">QString</a> &amp; <i>uri</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
<p>The reader calls this function to signal the begin of a prefix-URI namespace mapping scope. This information is not necessary for normal namespace processing since the reader automatically replaces prefixes for element and attribute names.</p>
<p>Note that startPrefixMapping() and <a href="qxmlcontenthandler.html#endPrefixMapping">endPrefixMapping</a>() calls are not guaranteed to be properly nested relative to each other: all startPrefixMapping() events occur before the corresponding <a href="qxmlcontenthandler.html#startElement">startElement</a>() event, and all <a href="qxmlcontenthandler.html#endPrefixMapping">endPrefixMapping</a>() events occur after the corresponding <a href="qxmlcontenthandler.html#endElement">endElement</a>() event, but their order is not otherwise guaranteed.</p>
<p>The argument <i>prefix</i> is the namespace prefix being declared and the argument <i>uri</i> is the namespace URI the prefix is mapped to.</p>
<p>If this function returns false the reader stops parsing and reports an error. The reader uses the function <a href="qxmlcontenthandler.html#errorString">errorString</a>() to get the error message.</p>
<p>See also <a href="qxmlcontenthandler.html#endPrefixMapping">endPrefixMapping</a>() and <a href="qtxml.html#namespace-support-via-features">Namespace Support via Features</a>.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
